package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.mapper.OpcAppVersionMapper;
import com.csun.cmny.provider.model.domain.OpcAppVersion;
import com.csun.cmny.provider.service.OpcAppVersionService;
import com.csun.cmny.util.PublicUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-09-23 11:35
 * @Description: the class opc app version service impl
 */
@Service
@Transactional
public class OpcAppVersionServiceImpl extends BaseService<OpcAppVersion>
        implements OpcAppVersionService {

    @Resource
    private OpcAppVersionMapper opcAppVersionMapper;

    /**
     * query ios shelf status
     *
     * @param opcAppVersion the opc app version
     * @return the ios app store shelf status
     */
    @Override
    public String queryIosShelfStatus(OpcAppVersion opcAppVersion) {

        // 默认都是正式版
        String status = "1";

        // 查询版本状态
        List<OpcAppVersion> opcAppVersionList = opcAppVersionMapper.select(opcAppVersion);
        if (PublicUtil.isNotEmpty(opcAppVersionList) && opcAppVersionList.size() > 0) {
            status = opcAppVersionList.get(0).getStatus();
        }

        return status;
    }
}
